package com.yict.common.query.bean;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.yict.common.util.StringUtil;

/**
 * <h3>Class name</h3> <h4>Description</h4> <h4>Special Notes</h4>
 * 
 * @ver 0.1
 * @author Jay.Wu 2008-8-26
 */

public class CondictionsBean {

	private String property;

	private Object value;

	private Object anotherValue;

	private String condiction = "=";

	/**
	 * 重复参数的顺序
	 */
	private int pos = -1;

	/**
	 * 被引用次数
	 */
	private int quoteCount = 0;

	/**
	 * @return the property
	 */
	public String getProperty() {
		return property;
	}

	/**
	 * @param property
	 *            the property to set
	 */
	public void setProperty(String property) {
		this.property = property;
	}

	/**
	 * @return the value
	 */
	public Object getValue() {
		if (value instanceof String) {
			if (StringUtil.isBlank((String) value)) {
				return null;
			} else if (value.toString().equals("%null%")) {
				return null;
			}
		}

		return value;
	}

	/**
	 * @param value
	 *            the value to set
	 */
	public void setValue(Object value) {
		this.value = value;
	}

	public void addQuoteCount() {
		quoteCount++;
	}

	public void removeQuoteCount() {
		quoteCount--;
	}

	public Object getAnotherValue() {
		return anotherValue;
	}

	public void setAnotherValue(Object anotherValue) {
		this.anotherValue = anotherValue;
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

	public int getPos() {
		return pos;
	}

	public void setPos(int pos) {
		this.pos = pos;
	}

	public int getQuoteCount() {
		return quoteCount;
	}

	public void setQuoteCount(int quoteCount) {
		this.quoteCount = quoteCount;
	}

	public String getCondiction() {
		return condiction;
	}

	public void setCondiction(String condiction) {
		this.condiction = condiction;
	}

}
